package com.jxcq.tensquare.base.controller;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class BaseExceptionHander {

  @ExceptionHandler(value = Exception.class)
  public Result exception(Exception e){
        e.printStackTrace();
        return new Result(false, StatusCode.FAILE,e.getMessage());
  }

  @ExceptionHandler(value = NullPointerException.class)
  public Result exception(NullPointerException e){
      e.printStackTrace();
      return new Result(false, StatusCode.FAILE,e.getMessage());
  }

}
